#include <iostream>

using namespace std;

struct ListNode {
	int value;
	ListNode *next;
	ListNode(int v, ListNode *n = nullptr) : value(v), next(n) {}
};

int main() {
	ListNode *header = nullptr;
	int num = 8;
	header = new ListNode(num);

	ListNode *tmp = header;
	ListNode *listNode = nullptr;
	while(num--) {
		listNode = new ListNode(num);
		cout << tmp->value << endl;
		tmp->next = listNode;
	}

	cout << "============" << endl;
	tmp = header;
	while(tmp->next != nullptr) {
		cout << tmp->value << endl;
		tmp = tmp->next;
	}
}
